<template>
  <div style="width:100%;height:100%;display: flex;justify-content: space-between;background-color: #fff;">
    <div style="width:10%;height:100%;">
      <el-tree :data="treeList" :props="defaultProps" @node-click="handleNodeClick" default-expand-all :expand-on-click-node="false"></el-tree>
    </div>
    <div style="overflow: hidden;width:85%;" id="xGridParent">
      <vxe-grid v-if="showType" ref='xGrid' v-bind="grid_options1" @form-reset="formResetEvent">
        <template #toolbar_tools>
           <div class="titletext" style="margin-top: -40px;" v-show="false">
             共计有<span @click="this.Modelcensu(allnum ,showType)">{{ allnum }}</span>台设备,其中
             <div style="display: inline-block;" v-for="item in wzEquipList" :key="item.sblxmc">
               {{ item.sblxmc }}有
               <span @click="this.Modelcensu(item,showType)">{{ item.equipNum }}</span>台;
             </div>
           </div>
        </template>
      </vxe-grid>
      <vxe-grid v-if="!showType" ref='xGrid' v-bind="grid_options2" @form-reset="formResetEvent">
        <template #toolbar_tools2>
          <div class="titletext" style="margin-top: -33px;" v-show="false">
            共计有<span @click="this.Modelcensu(allnumny,showType)">{{ allnumny }}</span>台设备,其中
            <div style="display: inline-block;" v-for="item in wzEquipnyList" :key="item.sblxmc">
              {{ item.sblxmc }}有
              <span @click="this.Modelcensu(item,showType)">{{ item.equipNum }}</span>台;
            </div>
          </div>
        </template>
    </vxe-grid>
      <el-dialog v-dialogDrag
                 :title="formModel.title" :visible.sync="formModel.dialogVisible" :width="formModel.width"
                 :closeOnClickModal="formModel.closeOnClickModal"
                 :before-close="tBizcEneryEquipFormCloseEvent">
        <accountQueryForm v-if="formModel.dialogVisible && formModel.componentId=='TBizcEneryEquipForm' "
                          :formData="formModel.TBizcEneryEquipFormData"
                          @closeEvent="tBizcEneryEquipFormCloseEvent"></accountQueryForm>
        <!-- 其他的弹出组件可以写在这里面 -->
      </el-dialog>
    <censuTable ref="censuTable"></censuTable>
    </div>
  </div>
</template>

<script>
import util from '@/utils/util'
import {reactive} from 'vue'
import {formModel, GridEvent} from './model/accountQuery-table.js'
import {accountQueryApi} from '@/api/equip/accountQueryApi.js'
import VXETable from "vxe-table";

export default {
  name:"accountQuery",
  components: {
    accountQueryForm: ()=>import("./components/accountQueryForm.vue"),
    censuTable:()=>import("./components/censu-table.vue")
  },
  data() {
    return {
      wzEquipList:[],
      wzEquipnyList:[],
      allnum:'',
      allnumny:'',
      showType: true,
      sblxbm:'',
      sbztbm:'',
      grid_options1: {
        border: true, 				//表格边框//
        stripe: true, 				//行斑马色//
        showHeaderOverflow: true, //标头影藏//
        showOverflow: true,       //显示隐藏//
        keepSource: true,         //保持原始值的状�?�，被某些功能所依赖，比如编辑状态�?�还原数据等（开启后影响性能，具体取决于数据量）//
        id: 'full_edit_1',        //表格id，保证唯�?�?//
        height: 700,              //表格默认高度//
        rowId: 'sbbm',            //指定记录主键//
        rowConfig: {
          isCurrent: true,        //当鼠标点击列头时，是否要高亮当前�?//
          isHover: true,          //当鼠标移到列头时，是否要高亮当前列头//
        },
        columnConfig: {
          resizable: true         //每一列是否启用列宽调�?//
        },
        customConfig: {
          resizable: true,
          storage: true,          //是否启用 localStorage 本地保存，会将列操作状�?�保留在本地（需要有 id�?//
          // checkMethod: this.checkColumnMethod   //自定义列是否允许列�?�中的方法，该方法的返回值用来决定这�?列的 checkbox 是否可以选中//
        },
        printConfig: {
          columns: [              //指定�?//
            { field: 'sbbm'},
            { field: 'sbmc' },
            { field: 'yxzt' },
            { field: 'jlfs' },
            { field: 'sfsc' },
            { field: 'cap' },
            { field: 'sblx' },
            { field: 'sblxmc' },
            { field: 'num' },
            { field: 'standard' },
            { field: 'xh' },
            { field: 'cjmc' },
            { field: 'ccbm' },
            { field: 'ccTime' },
            { field: 'sjdhTime' },
            { field: 'cyDwmc' },
            { field: 'xmlxr' },
            { field: 'xmmc' },
            { field: 'xmbh' },
            { field: 'zlqx' },
            { field: 'yjccTime' },
            { field: 'xmdz' },
            { field: 'lxrPhone' },
            { field: 'lxTime' },
            { field: 'djhszt' },
            { field: 'cyDwbm' },
          ]
        },
        sortConfig: {             //排序配置�?//
          trigger: 'cell',        //触发方式（注：当多种功能重叠时，会同时触发）//
          remote: true            //�?有列是否使用服务端排序，如果设置�? true 则不会对数据进行处理//
        },
        filterConfig: {
          remote: true            //�?有列是否使用服务端筛选，如果设置�? true 则不会对数据进行处理//
        },
        pagerConfig: {            //分页配置�?//
          pageSize: 10,           //每页大小//
          pageSizes: [5, 10, 15, 20, 50, 100, 200, 500, 1000],    //每页大小选项列表//
          layouts: ['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total'],    //自定义布�?//
          background: true        //带背景颜�?//
        },
        formConfig: {
          form: true,             //启用表单代理//
          size: 'small',          //尺寸//
          titleAlign: 'right',    //aa�?有项的标题对齐方式aa//
          titleWidth: '120',      //标题宽度aa//
          titleColon: true,       //是否显示标题冒号aa//
          collapseStatus: false,   //折叠状�?�aa//
          items: [                //项列表aa//
            {
              field: 'gldwbm',
              title: '单位',
              span: 6,
              itemRender: {name: '$select', options: [], props: {placeholder: '---请输入---', clearable: true}}
            },
            {
              field: 'ccbm',
              title: '出厂编码',
              span: 6,
              itemRender: {name: '$input', props: {placeholder: '---请输入---'}}
            },
            {
              field: 'sbmc',
              title: '设备名称',
              span: 6,
              itemRender: {name: '$input', props: {placeholder: '---请输入---'}}
            },
            {
              field: 'sskfmc',
              title: '库房名称',
              span: 6,
              folding: true,
              itemRender: {name: '$input', props: {placeholder: '---请输入---'}}
            },
            {
              field: 'sblxbm',
              title: '设备类型',
              span: 6,
              folding: true,
              itemRender: {name: '$select', options: [], props: {placeholder: '---请输入---', clearable: true}}
            },
            {
              field: 'yxzt',
              title: '运行状态',
              span: 6,
              folding: true,
              itemRender: {name: '$select', options: [], props: {placeholder: '---请输入---', clearable: true}}
            },
            {
              field: 'sbztbm',
              title: '设备状态',
              span: 6,
              folding: true,
              itemRender: {name: '$select', options: [], props: {placeholder: '---请输入---', clearable: true}}
            },
            {
              field: 'sftq',
              title: '是否贴签',
              span: 6,
              folding: true,
              itemRender: {
                name: '$select',
                options: [{label: '是', value: '1'}, {label: '否', value: '0'}],
                props: {placeholder: '---请输入---', clearable: true}
              }
            },
            //           10-未投运
    // 20-在运
    // 30-退役
    // 40-报废

              // 0未回收 1 已回收
              // { field: 'cyDwbm', title: '产业单位编码',span: 6,folding: true, itemRender:{name:'$input', props: {placeholder: '---请输入---'}}},
    //   //工具�?//
              { span: 6, align: 'center', collapseNode: true,itemRender: { name: '$buttons', children: [{ props: { type: 'submit', content: '查询', status: 'primary', icon:'fa fa-search' } }, { props: { type: 'reset', content: '重置',icon:'fa fa-reply'  } }] } }
          ]
        },
        toolbarConfig: {          //工具栏配�?//
          // buttons: [],       //左侧按钮列表//
          // refresh: true,          //刷新按钮配置//
          // import: true,        //导入按钮配置（需要设置import-config）//
          // export: true,        //导出按钮配置（需要设置export-config）aa//
          // print: true,         //打印按钮配置//
          // zoom: true,          //是否允许�?大化显示//
          // custom: true,           //自定义列配置//
          slots: {
            buttons: 'toolbar_tools'    //列表//
          }
        },
        proxyConfig: {
          seq: true, 		// 启用动�?�序号代理，每一页的序号会根据当前页数变�?//
          sort: true, 		// 启用排序代理，当点击排序时会自动触发 query 行为//
          filter: true, 	// 启用筛�?�代理，当点击筛选时会自动触�? query 行为//
          form: true, 		// 启用表单代理，当点击表单提交按钮时会自动触发 reload 行为//
          // 对应响应结果 { result: [], page: { total: 100 } }//
          props: {
              result: 'data.records', 		//配置响应结果列表字段//
              total: 'data.total' 			//配置响应结果总页数字�?//
          },
          // 鍙帴鏀禤romise锛屽叿浣撳疄鐜拌嚜鐢卞彂鎸�//
          ajax: {
            // 当点击工具栏查询按钮或�?�手动提交指�? query或reload 时会被触�?//
            query: async ({ page, sorts, filters, form }) => {
                //=====给表单项赋初始�??======//
                await GridEvent.initFormData(form,);
                const queryParams = Object.assign({}, form)
                //处理排序条件//
                const firstSort = sorts[0]
                if (firstSort) {
                    queryParams.sort = firstSort.property
                    queryParams.order = firstSort.order
                }
              //处理筛�?�条�?//
                filters.forEach(({ property, values }) => {
                    queryParams[property] = values.join(',')
                })
                this.wzEquipTj()
                return GridEvent.queryData(page,queryParams,this.showType)
            },
            //当点击工具栏删除按钮或�?�手动提交指�? delete 时会被触�?//
            // delete: ({ body }) => {
            //   return
            // },
            // //当点击工具栏保存按钮或�?�手动提交指�? save 时会被触�?//
            // save: ({ body }) => {
            //     return
            // }
          }
        },
        columns: [
          { type: 'seq',title: '序号',width:60,align:'center',headerAlign:'center'},
          { field: 'gldwmc', title: '单位',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'sbmc', title: '设备名称',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'ccbm', title: '出厂编码',minWidth:120, align:'center',headerAlign:'center',cellRender: { name: 'ccbm', events: { click: this.handleAuditPass }}},
          { field: 'sblxmc', title: '设备类型',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'pt', title: 'PT',minWidth:50, align:'center',headerAlign:'center',},
          { field: 'ct', title: 'CT',minWidth:50, align:'center',headerAlign:'center',},
          { field: 'sbztmc', title: '设备状态',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'sbgg', title: '规格',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'xh', title: '型号',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'yxztmc', title: '运行状态',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'sskfmc', title: '库房名称',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'sftq', title: '是否贴签',minWidth:120, align:'center',headerAlign:'center',
            // formatter ({ cellValue }) {
            //   return cellValue==='0'?'否':'是'
            // }
          }
    //       10-未投运
    // 20-在运
    // 30-退役
    // 40-报废
          // { field: 'jlfs', title: '计量方式',minWidth:150, align:'center',headerAlign:'center',},
          // // { field: 'sfsc', title: '是否删除',minWidth:150, align:'center',headerAlign:'center',},
          // // 0否1是
          // { field: 'cap', title: '容量',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'sblx', title: '设备类型编码  ',minWidth:150, align:'center',headerAlign:'center',},
          // // { field: 'sblxmc', title: '设备类型名称',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'num', title: '数量',minWidth:150, align:'center',headerAlign:'center',},

          // { field: 'cjmc', title: '厂家名称',minWidth:150, align:'center',headerAlign:'center',},


          // { field: 'sjdhTime', title: '实际到货日期',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'cyDwmc', title: '产业单位名称',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmlxr', title: '项目联系人',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmmc', title: '项目名称',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmbh', title: '项目编号',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'zlqx', title: '租赁期限',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'yjccTime', title: '预计撤场时间',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmdz', title: '项目地址',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'lxrPhone', title: '联系人电话',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'lxTime', title: '联络时间',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'djhszt', title: '单据回收状态',minWidth:150, align:'center',headerAlign:'center',},
          // 0未回收 1 已回收
          // { field: 'cyDwbm', title: '产业单位编码',minWidth:150, align:'center',headerAlign:'center',},
        ],
        importConfig: {                         //导入配置�?//
          remote: true,                         //是否服务端导�?//
          importMethod: this.importMethod,      //只对 remote=true 有效，该函数用于自定义导入或服务端导入，返回 Promise//
          types: ['xlsx'],                      //导入的文件类型列�?//
          modes: ['insert']                     //导入数据的方�?//
        },
        exportConfig: {                         //导出配置�?//
          remote: true,                         //是否服务端导�?//
          exportMethod: this.exportMethod,      //只对 remote=true 有效，该函数用于自定义导出或服务端导出，返回 Promise//
          types: ['xlsx'],                      //可�?�文件类型列�?//
          modes: ['current', 'selected', 'all'] //输出数据的方式列表，如果�? all，则会�?�过 proxy-config.ajax.queryAll 获取数据之后进行导出//
        },
        checkboxConfig: {                       //复�?�框配置�?//
          // labelField: 'id',                  //复�?�框显示的字段名，可以直接显示在复�?�框�?//
          reserve: true,                        //是否保留勾�?�状态，对于某些场景可能会用到，比如数据被刷新之后还保留之前选中的状态（�?要有 row-id�?//
          highlight: true,                      //高亮勾�?�行//
          range: true                           //�?启复选框范围选择功能（启用后通过鼠标在复选框的列内滑动�?�中或取消指定行�?//
        },
        editRules: {                            //校验规则配置�?//

        },
        editConfig: {                           //可编辑配置项//
          trigger: 'click',                     //触发方式//
          mode: 'row',                          //编辑模式//
          showStatus: true                      //只对 keep-source �?启有效，是否显示单元格新增与修改状�??//
        }
      },
      grid_options2: {
        border: true, 				//表格边框//
        stripe: true, 				//行斑马色//
        showHeaderOverflow: true, //标头影藏//
        showOverflow: true,       //显示隐藏//
        keepSource: true,         //保持原始值的状�?�，被某些功能所依赖，比如编辑状态�?�还原数据等（开启后影响性能，具体取决于数据量）//
        id: 'full_edit_1',        //表格id，保证唯�?�?//
        height: 700,              //表格默认高度//
        rowId: 'sbbm',            //指定记录主键//
        rowConfig: {
          isCurrent: true,        //当鼠标点击列头时，是否要高亮当前�?//
          isHover: true,          //当鼠标移到列头时，是否要高亮当前列头//
        },
        columnConfig: {
          resizable: true         //每一列是否启用列宽调�?//
        },
        customConfig: {
          resizable: true,         //每一列是否启用列宽调�?//
          storage: true
        },
        // customConfig: {
        //   storage: true,          //是否启用 localStorage 本地保存，会将列操作状�?�保留在本地（需要有 id�?//
        //   checkMethod: this.checkColumnMethod   //自定义列是否允许列�?�中的方法，该方法的返回值用来决定这�?列的 checkbox 是否可以选中//
        // },
        printConfig: {
          columns: [              //指定�?//
            {field: 'sbbm'},
            {field: 'sbmc'},
            {field: 'yxzt'},
            {field: 'jlfs'},
            {field: 'sfsc'},
            {field: 'cap'},
            {field: 'sblx'},
            {field: 'sblxmc'},
            { field: 'num' },
            { field: 'standard' },
            { field: 'xh' },
            { field: 'cjmc' },
            { field: 'ccbm' },
            { field: 'ccTime' },
            { field: 'sjdhTime' },
            { field: 'cyDwmc' },
            { field: 'xmlxr' },
            { field: 'xmmc' },
            { field: 'xmbh' },
            { field: 'zlqx' },
            { field: 'yjccTime' },
            { field: 'xmdz' },
            { field: 'lxrPhone' },
            { field: 'lxTime' },
            { field: 'djhszt' },
            { field: 'cyDwbm' },
          ]
        },
        sortConfig: {             //排序配置�?//
          trigger: 'cell',        //触发方式（注：当多种功能重叠时，会同时触发）//
          remote: true            //�?有列是否使用服务端排序，如果设置�? true 则不会对数据进行处理//
        },
        filterConfig: {
          remote: true            //�?有列是否使用服务端筛选，如果设置�? true 则不会对数据进行处理//
        },
        pagerConfig: {            //分页配置�?//
          pageSize: 10,           //每页大小//
          pageSizes: [5, 10, 15, 20, 50, 100, 200, 500, 1000],    //每页大小选项列表//
          layouts: ['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total'],    //自定义布�?//
          background: true        //带背景颜�?//
        },
        formConfig: {
          form: true,             //启用表单代理//
          size: 'small',          //尺寸//
          titleAlign: 'right',    //aa�?有项的标题对齐方式aa//
          titleWidth: '120',      //标题宽度aa//
          titleColon: true,       //是否显示标题冒号aa//
          collapseStatus: false,   //折叠状�?�aa//
          items: [                //项列表aa//
            {
              field: 'gldwbm',
              title: '单位',
              span: 6,
              itemRender: {
                name: '$select',
                options: [],
                props: {placeholder: '---请输入---', clearable: true},
                events: {change: this.gldwbmChangeEvent}
              }
            },
            {
              field: 'ssjfbm',
              title: '所属能源站',
              span: 6,
              itemRender: {name: '$select', options: [], props: {placeholder: '---请输入---', clearable: true}}
            },
            {
              field: 'ccbm',
              title: '出厂编码',
              span: 6,
              itemRender: {name: '$input', props: {placeholder: '---请输入---'}}
            },
            {
              field: 'sbmc',
              title: '设备名称',
              span: 6,
              folding: true,
              itemRender: {name: '$input', props: {placeholder: '---请输入---'}}
            },
            {
              field: 'sblxbm',
              title: '设备类型',
              span: 6,
              folding: true,
              itemRender: {name: '$select', options: [], props: {placeholder: '---请输入---', clearable: true}}
            },
            {
              field: 'yxzt',
              title: '运行状态',
              span: 6,
              folding: true,
              itemRender: {name: '$select', options: [], props: {placeholder: '---请输入---', clearable: true}}
            },
            {
              field: 'sfqy',
              title: '启用/停用',
              span: 6,
              folding: true,
              itemRender: {
                name: '$select',
                options: [{label: '启用', value: '1'}, {label: '停用', value: '0'}],
                props: {placeholder: '---请输入---', clearable: true}
              }
            },
            //           10-未投运
            // 20-在运
    // 30-退役
    // 40-报废

              // 0未回收 1 已回收
              // { field: 'cyDwbm', title: '产业单位编码',span: 6,folding: true, itemRender:{name:'$input', props: {placeholder: '---请输入---'}}},
    //   //工具�?//
              { span: 6, align: 'center', collapseNode: true,itemRender: { name: '$buttons', children: [{ props: { type: 'submit', content: '查询', status: 'primary', icon:'fa fa-search' } }, { props: { type: 'reset', content: '重置',icon:'fa fa-reply'  } }] } }
          ]
        },
        toolbarConfig: {          //工具栏配�?//
          // buttons: [],       //左侧按钮列表//
          // refresh: true,          //刷新按钮配置//
          // import: true,        //导入按钮配置（需要设置import-config）//
          // export: true,        //导出按钮配置（需要设置export-config）aa//
          // print: true,         //打印按钮配置//
          // zoom: true,          //是否允许�?大化显示//
          // custom: true,           //自定义列配置//
          slots: {
            buttons: 'toolbar_tools2'    //按钮列表//
          }
        },
        proxyConfig: {
          seq: true, 		// 启用动�?�序号代理，每一页的序号会根据当前页数变�?//
          sort: true, 		// 启用排序代理，当点击排序时会自动触发 query 行为//
          filter: true, 	// 启用筛�?�代理，当点击筛选时会自动触�? query 行为//
          form: true, 		// 启用表单代理，当点击表单提交按钮时会自动触发 reload 行为//
          // 对应响应结果 { result: [], page: { total: 100 } }//
          props: {
              result: 'data.records', 		//配置响应结果列表字段//
              total: 'data.total' 			//配置响应结果总页数字�?//
          },
          // 鍙帴鏀禤romise锛屽叿浣撳疄鐜拌嚜鐢卞彂鎸�//
          ajax: {
            // 当点击工具栏查询按钮或�?�手动提交指�? query或reload 时会被触�?//
            query: async ({ page, sorts, filters, form }) => {
                //=====给表单项赋初始�??======//
                await GridEvent.initFormData(form,);
                const queryParams = Object.assign({}, form)
                //处理排序条件//
                const firstSort = sorts[0]
                if (firstSort) {
                    queryParams.sort = firstSort.property
                    queryParams.order = firstSort.order
                }
              //处理筛�?�条�?//
                filters.forEach(({ property, values }) => {
                    queryParams[property] = values.join(',')
                })
                this.wzEquipTj()
                return GridEvent.queryData(page,queryParams,this.showType)
            },
            //当点击工具栏删除按钮或�?�手动提交指�? delete 时会被触�?//
            // delete: ({ body }) => {
            //   return
            // },
            // //当点击工具栏保存按钮或�?�手动提交指�? save 时会被触�?//
            // save: ({ body }) => {
            //     return
            // }
          }
        },
        columns: [
          { type: 'seq',title: '序号',width:60,align:'center',headerAlign:'center'},
          { field: 'gldwmc', title: '单位',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'sblxmc', title: '设备类型',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'sbmc', title: '设备名称',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'ccbm', title: '出厂编码',minWidth:120, align:'center',headerAlign:'center',cellRender: { name: 'ccbm', events: { click: this.handleAuditPass }}},
          { field: 'ssjfmc', title: '所属能源站',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'ccrq', title: '出厂日期',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'cjmc', title: '厂家',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'yxztmc', title: '运行状态',minWidth:120, align:'center',headerAlign:'center',},
          { field: 'tyrq', title: '投运日期',minWidth:120, align:'center',headerAlign:'center',}
    //       10-未投运
    // 20-在运
    // 30-退役
    // 40-报废
          // { field: 'jlfs', title: '计量方式',minWidth:150, align:'center',headerAlign:'center',},
          // // { field: 'sfsc', title: '是否删除',minWidth:150, align:'center',headerAlign:'center',},
          // // 0否1是
          // { field: 'cap', title: '容量',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'sblx', title: '设备类型编码  ',minWidth:150, align:'center',headerAlign:'center',},
          // // { field: 'sblxmc', title: '设备类型名称',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'num', title: '数量',minWidth:150, align:'center',headerAlign:'center',},

          // { field: 'cjmc', title: '厂家名称',minWidth:150, align:'center',headerAlign:'center',},


          // { field: 'sjdhTime', title: '实际到货日期',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'cyDwmc', title: '产业单位名称',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmlxr', title: '项目联系人',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmmc', title: '项目名称',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmbh', title: '项目编号',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'zlqx', title: '租赁期限',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'yjccTime', title: '预计撤场时间',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'xmdz', title: '项目地址',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'lxrPhone', title: '联系人电话',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'lxTime', title: '联络时间',minWidth:150, align:'center',headerAlign:'center',},
          // { field: 'djhszt', title: '单据回收状态',minWidth:150, align:'center',headerAlign:'center',},
          // 0未回收 1 已回收
          // { field: 'cyDwbm', title: '产业单位编码',minWidth:150, align:'center',headerAlign:'center',},
        ],
        importConfig: {                         //导入配置�?//
          remote: true,                         //是否服务端导�?//
          importMethod: this.importMethod,      //只对 remote=true 有效，该函数用于自定义导入或服务端导入，返回 Promise//
          types: ['xlsx'],                      //导入的文件类型列�?//
          modes: ['insert']                     //导入数据的方�?//
        },
        exportConfig: {                         //导出配置�?//
          remote: true,                         //是否服务端导�?//
          exportMethod: this.exportMethod,      //只对 remote=true 有效，该函数用于自定义导出或服务端导出，返回 Promise//
          types: ['xlsx'],                      //可�?�文件类型列�?//
          modes: ['current', 'selected', 'all'] //输出数据的方式列表，如果�? all，则会�?�过 proxy-config.ajax.queryAll 获取数据之后进行导出//
        },
        checkboxConfig: {                       //复�?�框配置�?//
          // labelField: 'id',                  //复�?�框显示的字段名，可以直接显示在复�?�框�?//
          reserve: true,                        //是否保留勾�?�状态，对于某些场景可能会用到，比如数据被刷新之后还保留之前选中的状态（�?要有 row-id�?//
          highlight: true,                      //高亮勾�?�行//
          range: true                           //�?启复选框范围选择功能（启用后通过鼠标在复选框的列内滑动�?�中或取消指定行�?//
        },
        editRules: {                            //校验规则配置�?//

        },
        editConfig: {                           //可编辑配置项//
          trigger: 'click',                     //触发方式//
          mode: 'row',                          //编辑模式//
          showStatus: true                      //只对 keep-source �?启有效，是否显示单元格新增与修改状�??//
        }
      },
      treeList: [{
          name: '台账列表',
          children: []
        }],
        defaultProps: {
          children: 'children',
          label: 'name',

        },
      size: "small",  //按钮尺寸大小//
      GridEvent: reactive(GridEvent),
      formModel: reactive(formModel),
      wzlbbm: '',
      // sblxbm: ''
    }
  },

  methods: {
    //点击节点数据切换
    handleNodeClick(data) {
      console.log(data)
      if (data.isLeaf === '1') {

        if (data.pid === '2000') {
          this.showType = false
          GridEvent.getOptionData_sblxmc(this.$refs.xGrid, data.pid, data.id)
        } else {
          this.showType = true
          GridEvent.getOptionData_sblxmc(this.$refs.xGrid, data.pid, data.id)
        }
        this.sblxbm = data.id
        GridEvent.getOptionData_yxzt(this.$refs.xGrid)
        GridEvent.getOptionData_gldw(this.$refs.xGrid)
      } else {
        if (data.id === '2000') {
          this.sblxbm = data.id
          this.showType = false
          GridEvent.getOptionData_yxzt(this.$refs.xGrid)
          GridEvent.getOptionData_sblxmc(this.$refs.xGrid,'2000','')
        } else {
          this.sblxbm = data.id
          this.showType = true
        }
        if(data.name=='台账列表'){
          this.showType = true
        }
        this.$refs.xGrid.formData.sblxbm = ''

        this.$refs.xGrid.formData.wzlbbm = data.id
        this.wzlbbm = data.id

        this.$refs.xGrid.commitProxy('query')
      }
    },
    formResetEvent({ data}) {
      data['sfqy'] = '1'
      if(this.sblxbm==2000 ||this.sblxbm==1000 ){
        data['sblxbm']==''
      }else{
         data['sblxbm'] = this.sblxbm
      }
      const item = this.$refs.xGrid.getFormItems(1)
      item.itemRender.options = []
    },
    Modelcensu(num,type){
      console.log(num,type)
      this.$refs.censuTable.showDialog(true,num,true,type)

    },
    wzEquipTj(){

      GridEvent.getOptionData_gldw(this.$refs.xGrid)
      let params = {
      }
      accountQueryApi.wzEquipTj(params).then(res =>{
        this.allnum = res.data.allNum
        this.wzEquipList = res.data.wzEquipList
      })
      accountQueryApi.jfEquipTj(params).then(res =>{
        this.allnumny = res.data.allNum
        this.wzEquipnyList = res.data.wzEquipList
      })
    },
    gldwbmChangeEvent(value) {
      this.$refs.xGrid._data.formData.ssjfbm=null
      GridEvent.gldwbmChangeEvent(this.$refs.xGrid, value)
    },
    getTreeTable(){
      var treeData = []
      accountQueryApi.queryDictData().then(res=>{
        if (res.code === 200) {
          res.data.map(item => {
            accountQueryApi.queryDictDatasb(item.id).then(res => {
              item.children = res.data
              treeData.push(item)
            })
          })
        }
      })
      this.treeList[0].children = treeData
    },
    handleAuditPass(row) {
      GridEvent.viewForm(row, this.showType)
    },
    setTableHeight: function(){ //高度自�?�应//
      const tableContainer = document.querySelector("#xGridParent");
      const height = tableContainer.clientHeight;
      this.grid_options1.height = height-5;
      this.grid_options2.height = height-5;
    },
    tBizcEneryEquipFormCloseEvent(reload){  //form表单编辑窗口关闭事件//
      formModel.closeDialogEvent(reload, this.$refs.xGrid)
    },
    editEvent(){    //编辑事件//
      const rows = this.$refs.xGrid.getCheckboxRecords(true);
      if(rows && rows.length ==1){
        GridEvent.editForm(rows[0]);
      }else{
          this.$message.warning("只能选中1行数据进行编辑")
      }
    },
    deleteEvent(){  //删除事件//
      const rows = this.$refs.xGrid.getCheckboxRecords(true);
      if(rows){
        GridEvent.deleteEvent(rows, this.$refs.xGrid);
      }
    },
    exportWord(){//导出事件
      // alert('导出')
      GridEvent.exportXls(this.$refs.xGrid);
    },
    handlePreview(info){//模板导入
      console.log(info,'iiiiiii');
      // GridEvent.exportXls(info);
      // let formData = new FormData();
      // formData.append("file",info.file);
      // formData.append("type","bzyhk");
      // SupportpersonnelApi.importXls(formData).then(res=>{
      //   antd.message.success(res)
      // }).catch(err=>{
      //   console.log(err)
      // })
      // GridEvent.exportXls(this.$refs.xGrid);
    },
    downloadXls(){
      window.open(process.env.VUE_APP_APP_API+'/equip/export/downloadTemplate')
      console.log(process.env.VUE_APP_APP_API+'/equip/export/downloadTemplate','地址');
    },
    handleView(row) {
      GridEvent.viewForm(row)
    },
    //首页跳转数据判断
    sbztType(){
      this.sbztbm=util.getRequestParms('sbztbm')
      if(this.sbztbm){
        this.$refs.xGrid._data.formData.sbztbm= this.sbztbm
      }

      let sblx=util.getRequestParms('sblxbm')
      let nyz=util.getRequestParms('nyz')
      //能源站设备跳转
      if(nyz){
        this.showType = false
        GridEvent.getOptionData_sblxmc(this.$refs.xGrid, '2000', '')
        this.$refs.xGrid.formData.sblxbm = ''
        this.$refs.xGrid.formData.wzlbbm = '2000'
      }
      if(sblx){
        //设备类型跳转
        // console.log("44")
        // this.showType=false
        GridEvent.getOptionData_sblxmc(this.$refs.xGrid, '2000', sblx)
          //  this.$refs.xGrid._data.formData.sblxbm= sblx


        // GridEvent.getOptionData_sblxmc(this.$refs.xGrid, '10001', '')
      }else{
        GridEvent.getOptionData_sblxmc(this.$refs.xGrid, '1000', '')
      }
    },
  },
  mounted () {
    this.$nextTick(function(){
      // this.setTableHeight();
      GridEvent.getOptionData_gldw(this.$refs.xGrid)
      GridEvent.getOptionData_yxzt(this.$refs.xGrid)
      // GridEvent.getOptionData_sblxmc(this.$refs.xGrid, '1000', '')
      GridEvent.getOptionData_sbzt(this.$refs.xGrid)
      this.wzEquipTj()//物资设备统计
      this.sbztType()//首页跳转
    })
    window.addEventListener('resize',this.setTableHeight);
    this.getTreeTable()
  },
  destroyed () {
    window.removeEventListener('resize',this.setTableHeight);
  },
}
//入库数量穿透渲染
VXETable.renderer.add('ccbm', {
  renderDefault(h, renderOpts, params) {
    const {events = {}} = renderOpts
    const {row, column} = params
    return [
      <span style="color:#0000FF;cursor: pointer;" onClick={
        () => {
          events.click(params.row)
        }
      }>{params.row.ccbm}</span>
    ]
  }
})
</script>

<style scoped>
.upload-demo{
  display: inline;
  margin-left: 10px;
}
.titletext{
  color:red;
  margin-top: 5px;
  font-size: large;
  margin-left: 70px;
}
.titletext span{
  color: #0000ff;
  cursor: pointer;
}

</style>

